import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Test {

    private static User logIn() {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入名字：");
        String name = in.nextLine();
        System.out.println("请输入身份：");
        System.out.println("1.普通用户     2.管理员");
        int choice = in.nextInt();
        if(choice == 1){
            NormalUser normalUser = new NormalUser(name);
            return normalUser;
        }else{
            AdminUser adminUser = new AdminUser(name);
            return adminUser;
        }
}

    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = logIn();
        while(true){
            int choice = user.menu();
            user.doOperation(choice, bookList);
        }
    }
}
